<?php
$search = $_GET['search'] ?? '无';
if($search == '无') {
    die('搜索内容不能为空');
}
require('../cofd/common.php');
$sql = "SELECT * FROM post WHERE phead LIKE '%$search%'";
$data = [];
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
    while ($row = mysqli_fetch_assoc($result)) {
        $data[] = $row;
    }
}else{
    echo json_encode(array('msg'=>400,'retu'=>$data), JSON_UNESCAPED_UNICODE);
    return;
}
echo json_encode(array('msg'=>250,'retu'=>$data), JSON_UNESCAPED_UNICODE);
$conn ->close();